$(function() {
	$("div.small-menu span").css("opacity","0");
	$("div.small-menu span").hover(function () {
		$(this).stop().animate({
			opacity: 1
		}, 400);
	},
	function () {
		$(this).stop().animate({
			opacity: 0
		}, 400);
	});
	
	$("div.product-menu span").css("opacity","0");
	$("div.product-menu span").hover(function () {
		$(this).stop().animate({
			opacity: 1
		}, 400);
	},
	function () {
		$(this).stop().animate({
			opacity: 0
		}, 400);
	});
	
	$("div.smallimage").on("click", function(){
		var classes = $(this).attr("class");
		var image = classes.split(' ');
		image = image[1];
		$("div.main-image").css("background-image", "url('../../../img/" + image + ".jpg')");
		$("div.smallimage").removeClass("active");
		$(this).addClass("active");
	});
	
	$("#submit").on('click', function() 
	{
		var parent = $(this).parents().eq(2);
		var name = parent.find("#name").val();
		var email = parent.find("#email").val();
		var website = parent.find("#website").val();
		var comment = parent.find("#comment").val();
		
		var dataString = "name=" + name + "&email=" + email + "&website=" + website + "&comment" + comment;
		$.ajax({
			type: "POST",
			url: "email/email.php",
			data: dataString,
			cache: false,

			success: function(html)
			{
				parent.parent().hide();
				parent.parents().eq(1).html("<br /><br /><br /><br /><br />" + html);
				
			} 
		});

		return false;
	});
});